// run: $exec < input
#include <cstdio>
#include <unordered_map>

int main()
{
	int n, a;
	std::scanf("%d\n%d", &n, &a);
	std::unordered_map<int, int> prime_factor;
	for (int i = 2; i * i <= a; i++) {
		int count = 0;
		while (!(a % i)) {
			count++;
			a /= i;
		}
		if (count) prime_factor[i] = count;
	}
	if (a != 1) prime_factor[a] = 1;
	for (int i = 1; i < n; i++) {
		std::scanf("%d", &a);
		for (int p = 2; p * p <= a; p++) {
			int count = 0;
			while (!(a % p)) {
				count++;
				a /= p;
			}
			if (p <= 3) continue;
			if (prime_factor[p] != count) {
				std::printf("No\n");
				return 0;
			}
		}
		if (a > 3 && prime_factor[a] != 1) {
			std::printf("No\n");
			return 0;
		}

	}
	std::printf("Yes\n");
}

